﻿// <copyright file="ITransformationContextProvider.cs" company="Oleg Sych">
//  Copyright © Oleg Sych. All Rights Reserved.
// </copyright>

namespace T4Toolbox
{
    using System.Runtime.InteropServices;
    using Microsoft.VisualStudio.TextTemplating.VSHost;

    /// <summary>
    /// Encapsulates host-specific functionality required by the <see cref="TransformationContext"/>.
    /// </summary>
    [Guid("2B1575B6-6135-4CCA-820B-63980CF62BC3")] // This is a global Visual Studio service
    public interface ITransformationContextProvider
    {
        /// <summary>
        /// Returns value of an MSBuild metadata with the specified <paramref name="metadataName"/>.
        /// </summary>
        /// <param name="hierarchy">
        /// An IVsHierarchy object returned by <see cref="ITextTemplatingComponents.Hierarchy"/> that represents an MSBuild project containing the file.
        /// </param>
        /// <param name="fileName">
        /// Full path of the file whose metadata is to be returned.
        /// </param>
        /// <param name="metadataName">
        /// Name of the MSBuild metadata element whose value is to be returned.
        /// </param>
        string GetMetadataValue(object hierarchy, string fileName, string metadataName);

        /// <summary>
        /// Returns value of an MSBuild property with the specified <paramref name="propertyName"/>.
        /// </summary>
        /// <param name="hierarchy">
        /// An IVsHierarchy object returned by <see cref="ITextTemplatingComponents.Hierarchy"/> that represents an MSBuild project whose property is to be retrieved.
        /// </param>
        /// <param name="propertyName">
        /// Name of the property in the MSBuild project.
        /// </param>
        string GetPropertyValue(object hierarchy, string propertyName);

        /// <summary>
        /// Updates output files generated by a text template.
        /// </summary>
        /// <param name="inputFile">
        /// A <see cref="string"/> that contains name of the template file.
        /// </param>
        /// <param name="outputFiles">
        /// An array of <see cref="OutputFile"/> objects that contain content and attributes of the output files.
        /// </param>
        void UpdateOutputFiles(string inputFile, OutputFile[] outputFiles);
    }
}
